// FrogSortDesktopDialog.h : Declaration of the CFrogSortDesktopDialog

#pragma once

#include "resource.h"       // main symbols
#include <atlhost.h>
#include "FrogBaseDialog.h"
#include "Controls\ColorButton.h"
#include <gdiplus.h>
#include "DesktopSortConfig.h"

// CFrogSortDesktopDialog

class CFrogSortDesktopDialog: public CFrogBaseDialog<CFrogSortDesktopDialog>,
	public CWinDataExchange<CFrogSortDesktopDialog>
{
public:
	CFrogSortDesktopDialog(HICON hIcon);

	enum { IDD = IDD_DIALOG_SORT_DESKTOP };

	BEGIN_MSG_MAP(CFrogSortDesktopDialog)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)
		COMMAND_HANDLER(IDC_CHECK_USE_WALLPAPER, BN_CLICKED, OnCheckUseWallpaper);
		COMMAND_ID_HANDLER(IDC_BUTTON_FONT, OnButtonFont)
		NOTIFY_ID_HANDLER(IDC_SLIDER_OPACITY_1, OnSliderOpacity1Change)
		NOTIFY_ID_HANDLER(IDC_SLIDER_OPACITY_2, OnSliderOpacity2Change)
		// FrogBaseDialog Inherited
		CHAIN_MSG_MAP(CFrogBaseDialog)
		REFLECT_NOTIFICATIONS()
	END_MSG_MAP()

	BEGIN_DDX_MAP(CFrogSortDesktopDialog)	
		DDX_CHECK(IDC_CHECK_USE_WALLPAPER, m_UseExistingWallaper)
	END_DDX_MAP()

	// Handler prototypes:
	//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnCheckUseWallpaper(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	static DesktopSortConfig s_DesktopSortConfig;
	
	bool m_UseExistingWallaper;

private:
	CColorButton m_ColorBtn1;
	CColorButton m_ColorBtn2;

	CColorButton m_ColorItemBtn1;
	CColorButton m_ColorItemBtn2;

	CColorButton m_ColorBorderBtn;

	CStatic m_FontName;

	CTrackBarCtrl m_SliderOpacityGroup;
	CTrackBarCtrl m_SliderOpacityBorder;

	void EnableDisableButtons();
	void GetSelectedFont(CStatic& fontName);
	void UpdateFontLabel(CStatic& fontName, const LOGFONTW& font);

	LRESULT OnSliderOpacity1Change(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnSliderOpacity2Change(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnButtonFont(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
};


